package com.zxl.openapi.config;


import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.amqp.core.Queue;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SearchConfig {

    @Value("${es.host:10.9.63.247}")
    private String host;

    @Value("${es.port:#{5672}}")
    private int port;


    @Bean
    public RestHighLevelClient client(){

        RestClientBuilder builder = RestClient.builder(new HttpHost(host,port));

        return new RestHighLevelClient(builder);

    }

    @Bean
    public Queue queue() {
        return new Queue("suibianbigemingzi");
    }

}
